<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div>

        <ul id="mylist">
            <li>北京</li>
            <li>上海</li>
            <li>四川</li>
            <li>深圳</li>

        </ul>
    </div>


    <script>

       var ul = document.querySelector('li');
        var list = document.getElementById('mylist');
        ul.textContent = "广州";
        list.append(ul);

        ul.textContent = "广州";


        let firstLi = list.firstChild;


        list.insertBefore(ul, firstLi);


        var beijing = list.childNodes[0];
        var guangzhuan = list.childNodes[ul.childNodes.length - 1];
        list.replaceChild(guangzhuan, beijing)



        list.removeChild(guangzhuan);

        for (var i = 0; i < list.childNodes.length; i++) {

            console.log(list.childNodes[i].textContent);
        }

        for (var i = 0; i < list.childNodes.length; i++) {
            if(list.childNodes[i].textContent==="北京"){
                console.log( "beijnhg",list.childNodes[i])

            }


        }









    </script>

</body>

</html>